task: Add versioning to regenerating response#361
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for multiple response versions, enabling users to regenerate bot responses and navigate through a history of versions for a single message. The changes include new data structures for response versions, updated state management to track ratings per version, and UI enhancements in the bot bubble for version navigation. Review feedback highlights the need for defensive checks in the regeneration logic, more robust error handling when parsing stored chat history, and better cleanup in callback refs.
6fb52a4 to
0ecad59
Compare
…ated outputs on each assistant message and add previous/next navigation so users can compare alternate regenerated responses in place.
d385ea3 to
4fc71b5
Compare
| const cleanedMessage = errorMessage.replace(/^Error:\s*\S+\s*-\s*/, ''); | ||
| setMessages((prevMessages) => { | ||
| const allMessages = [...prevMessages, { message: props.errorMessage || cleanedMessage, type: 'apiMessage' as messageType }]; | ||
| const lastMsg = prevMessages[prevMessages.length - 1]; |
There was a problem hiding this comment.
Logic below differentiates the different scenarios of when errors are happening and treats them differently.
Mostly noticeably, when a successful response follows an error, the user would see both messages which is confusing ux. Going on the route of silencing the error if there is a valid message, to suppress the error, but down the line we should explore designs of exposing this error, maybe as a toast or notif somewhow.
| break; | ||
| case 'error': | ||
| updateErrorMessage(payload.data); | ||
| closeResponse(); |
There was a problem hiding this comment.
Ensure feedback buttons always appear after bot messages, even when errors occur.
Add support for versioning of regenerated response (ie, i can see the history of the regenerated responses)
Each response has unique messageId and feedback capabilities.
Screen.Recording.2026-04-07.at.11.39.03.AM.mov